package com.java.gamePackeg.event;

import com.java.gamePackeg.Player;
import com.java.gamePackeg.Product;
import com.java.gamePackeg.XianLiveMain;

import javax.swing.*;
import java.util.List;

public class GoodEvent implements Event {
    private static final int money = 1000;
    private static final int FREE_PRO_COUNT = 1;

    @Override
    public void event(Player player, List<Product> marketProList) {
        JOptionPane.showMessageDialog(null, "做好事奖励1000元，并送了一个小电驴");

        Product product = XianLiveMain.getProList().get(3);
        //价格为0
        product.setNowPrice(0);
        //添加到列表
        player.buyPro(product, FREE_PRO_COUNT, false);
        player.setMoney(Math.round(player.getMoney() + money));

    }


}
